import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBConnection{
	private Connection conn = null;
	
	public Connection createConnection(){
		
		try{
			Class.forName("org.hsqldb.jdbcDriver");
			conn = DriverManager.getConnection("jdbc:hsqldb:MyDB2","sa","");
		}catch(SQLException sqle){
			sqle.printStackTrace(System.out);
		
		}catch(ClassNotFoundException cfe){
			cfe.printStackTrace(System.out);
		}		
		
		return conn;
	}
	
	public void destroyConnection(){
		try{
			if(conn != null){
				conn.close();
			}
		}catch(Exception e){
			e.printStackTrace(System.out);
		}
	}

}
